#!/bin/bash

#=======================================================================
# git-wn
# File ID: 149ce758-8aca-11e0-afed-37ea9f2067e0
# [Description]
# License: GNU General Public License version 2 or later.
#=======================================================================

if test "$1" = "-h" -o "$1" = "--help"; then
    cat <<'HELP_END'

git "what's new"

Syntax: git wn [commit] [git-lg_args]

If commit is not specified, use HEAD. To use lg_args, a 
commit/branch/tag/whatever has to be specified as $1.

HELP_END
    exit 0
fi
unset branches
from="$1"
shift
test -z "$from" && from=HEAD
git log -1 $from &>/dev/null || { echo $from: Invalid ref >&2; exit 1; }
lg_args="$@"

for f in $(git lc $from); do
    branches="$branches $from..$f"
done
git lg --date-order $lg_args $branches
